<?php
class Indexs extends CI_Controller
{

	public function __construct()
	{

		parent::__construct();
        $this->load->helper('url_helper');
		$this->load->library('session');
		$this->load->library('encryption');
		$this->load->model("leave_model");
		$this->load->model("user_model");
	}
	public function index()
	{
		$data = array();
		if(!isset($_SESSION['user_state']))
		{
			$this->load->view('index',$data);
		}
		else
		{
			$data['years'] = $this->leave_model->getYears();
			$data['leave'] = $this->leave_model->getTotalLeaveDays();
			$data['sick'] = $this->leave_model->getTotalSickDays();
			$data['user_name'] =  $this->user_model->getProfileState(array("user_id"=>$_SESSION['user_id']))['user_name'];
			$this->load->view("main",$data);
		}
	}



	

}
